<script setup lang="ts">
import { ref, reactive, h } from "vue";
import { getListApi } from "/@/api/psi/inventory";
import { dataFormatter } from '/@/utils/data'

// 表格配置
const tableRef = ref<YTableInstance>();
const tableProps = reactive<YTableProps>({
  height: "auto",
  columns: [
    { field: "warehouseId", label: "仓库", width: 100, formatter: (v) => dataFormatter(v, 'Warehouse') },
    { field: "materialCode", label: "品号", width: 100 },
    { field: "materialName", label: "品名", width: 100 },
    { field: "materialSpec", label: "规格", width: 100 },
    { field: "materialUnit", label: "单位", width: 100 },
    { field: "materialCalcUnit", label: "计量单位", width: 100 },
    { field: "quantity", label: "数量", width: 100 },
    { field: "calcQuantity", label: "计量", width: 100 },
    // { field: "createTime", label: "创建时间", component: 'ElDatePicker' },
    // { field: "createUser", label: "创建人" },
    // { field: "updateTime", label: "更新时间", component: 'ElDatePicker' },
    // { field: "updateUser", label: "更新人" },
  ],
  remoteConfig: {
    api: getListApi,
    immediate: true
  },
  filters: [{ label: '品号/品名', field: 'keyword' }]
});

</script>
<template>
  <IndexLayout>
    <YTable v-bind="tableProps" ref="tableRef"></YTable>
  </IndexLayout>
</template>